<extend name="Comon:laout"/>

<block name="cont">

<div class="clearfix  Inside_pages">
 <!--位置-->
 <div id="goodsInfo">
 <div class="Location_link">
  <em></em><!-- <a href="#">进口食品、进口牛</a>  &lt;   <a href="#">进口饼干/糕点</a>   &lt;   <a href="#">产品名称</a> -->
 </div>
 <!--产品详细介绍-->
 <div class="Details_style clearfix" >
  <div class="mod_picfold clearfix">
    <div class="clearfix" id="detail_main_img">
   <div class="layout_wrap preview">
     <div id="vertical" class="bigImg">
    <img src="__ROOT__/{$goods.img}" width="" height="" alt="" id="midimg" />
    <div style="display:none;" id="winSelector"></div>
  </div>
     <div class="smallImg">
    <div class="scrollbutton smallImgUp disabled">&lt;</div>
    <div id="imageMenu">
      <ul>
        <li><img src="__ROOT__/{$goods.img}" width="68" height="68" alt="洋妞"/></li>
        <foreach name="goods.photo" item="vp">
          <li><img src="__ROOT__/{$vp}" width="68" height="68" alt="洋妞"/></li>
        </foreach>
      </ul>
    </div>
    <div class="scrollbutton smallImgDown">&gt;</div>
  </div><!--smallImg end-->
  <div id="bigView" style="display:none;"><div><img width="800" height="800" alt="" src="" /></div></div>
   </div>
  </div>
     <div class="Sharing">
   <div class="bdsharebuttonbox bdshare-button-style0-16" data-bd-bind="1441079683326"><a href="#" class="bds_more" data-cmd="more">分享到：</a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a></div>
<script>
window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{"bdSize":16},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到：","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
</script>
  <!--收藏-->
    <div class="Collect"><a href="javascript:collect(92)"><em class="ico1"></em>收藏商品( 2345 )</a></div>
   </div>
   </div>
   <!--信息样式-->
    <div class="textInfo">

        <form action="{:U('home/goods/addcart')}" name="ECS_FORMBUY" id="ECS_FORMBUY" method="post">
            <div class="title"><h1>{$goods.name}</h1><p>{:htmlspecialchars_decode($goods['edit'])}</p></div>

            <div class="mod_detailInfo_priceSales">
              <div class="margins">
                  <div class="Price clearfix">
                      <label>价格</label><span>￥{$goods.sale_price}元 &nbsp;&nbsp;<b>{$goods.goods_price}元</b></span>
                  </div>
                  <div class="Activity clearfix"><label>活动</label><span>指定商品满¥50，可换购以下任一商品</span></div>

                  <span id="count" hidden>{:count($spec)}</span>

                   <foreach name="spec" item ="vs">
                      <div class="p_Size clearfix aa"><label>{$vs.name}</label><dd class="left">
                          <foreach name="vs.goods_spec_attr" item="vt">
                            <div class="item bb" attrid="{$vt.id}"><b></b><a href="#none" title="小礼盒">{$vt.name}</a></div>
                          </foreach>
                      </div>
                   </foreach>


              </div>
              <div class="s_Review">
                <a href="#">好评率<b>95%</b>[评论<b>87653</b>条]</a>
              </div>
            </div>

            <span id="id" hidden>{:I('get.id')}</span>

            <div class="mod_detailInfo_priceSales select" style="display:none">
                 <div class="Price clearfix"><span>请选择规格： &nbsp;&nbsp;</span></div>
            </div>

           <div class="buyinfo" id="detail_buyinfo">
                <dl>
                    <dt>数量</dt>
                    <dd>
                        <div class="choose-amount left " >
                            <a class="btn-reduce" href="javascript:;" >-</a>
                            <a class="btn-add" href="javascript:;" >+</a>
                            <input disabled class="text" id="buy-num" value="1";" name="num">
                       </div>
                       <div class="P_Quantity">剩余：件</div>
                    </dd>

                  <dd>
                    <div class="wrap_btn">
                        <a href="JavaScript:void(0)" class="wrap_btn1" title="加入购物车"></a>
                        <a href="JavaScript:void(0)" class="wrap_btn2" title="立即购买"></a>
                    </div>
                  </dd>

                </dl>
            </div>
            <input type="hidden" id="goods_id" name="goods_id" value=''  >
            <input type="hidden" id="spec_rule" name="spec_rule" value=''  >
            <input type="hidden" id="spec_price" name="spec_price" value=''  >
            <input type="hidden" id="is_pay" name="is_pay" value='0'  >


        </form>
            <div class="Guarantee clearfix">
                 <dl><dt>支付方式</dt><dd><em></em>货到付款（部分地区）</dd><dd><em></em>在线支付</dd>
                     <dd>
                        <div class="payment " id="payment">
                            <a href="javascript:void(0);" class="paybtn">支付方式<span class="iconDetail"></span></a>
                            <ul><li>货到付款</li><li>礼品卡支付</li><li>网上支付</li><li>银行转账</li></ul></div>
                    </dd>
                 </dl>
            </div>

  </div>


  <!--产品-->
  <div class="clearfix">

   <div class="right_style">
  <div class="inDetail_boxOut ">
   <div class="inDetail_box">
    <div class="fixed_out ">
     <ul class="inLeft_btn fixed_bar">
                  <li class="active"><a id="property-id" href="#shangpsx" class="current">规格与包装</a></li>
                  <li><a id="detail-id" href="#shangpjs">商品属性</a></li>
                  <li><a id="shot-id" href="#miqsp">售后服务</a></li>
                  <li><a id="coms1-id" href="#coms1">买家评论</a></li>
                </ul>
               <div class="subbuy">
          <span class="extra currentPrice"> ¥29.90</span>
          <a href="#" class="extra  notice J_BuyButtonSub">立即购买</a></div>
    </div>
   </div>
  </div>

   <div id="shangpsx">
    <ul class="shangpsx_info">
        <li><label>生产许可证编号</label><span>QS3301 1401 0973</span></li>
        <li><label>产品标准号</label><span>GB/T 18650</span></li>
        <li><label>生产日期</label><span>2015年4月</span></li>
        <li><label>有效期</label><span>三年</span></li>
        <li><label>产品名称</label><span>艺福堂茶叶 绿茶 龙井茶 西湖龙井 雨前靠谱茶</span></li>
        <li><label>净含量</label><span>250g</span></li>
        <li><label>包装</label><span>罐装</span></li>
        <li><label>品牌</label><span>艺福堂</span></li>
        <li><label>食品工艺</label><span>炒青绿茶</span></li>
        <li><label>级别</label><span>三级</span></li>
        <li><label>产地</label><span>中国大陆杭州</span></li>
        <li><label>价格</label><span>100-199元</span></li>
       </ul>
   </div>
   <div id="shangpjs"><img src="images/xinxi.png" /></div>
   <div id="miqsp">

   </div>
   <div id="coms1">

   </div>
  </div>
  </div>
 </div>
</block>
<block name="js">
<script src="__HOME__js/jqzoom.js" type="text/javascript"></script>
<script type="text/javascript">

        $(function(){



              //规格项选中效果
              $('.bb').click(function(){
                  var status = $(this).attr('class');

                  if(status=='item bb'){
                     //先将所有选中的样式改成未选中
                     $(this).parent().find('.bb').attr('class','item bb');
                     //将点击的改成选中样式
                     $(this).attr('class','item selected bb');

                  }else{
                      //改成未选中样式
                      $(this).attr('class','item bb');
                   }

                   //获取选中项的id
                   var spec_rule='';
                   var le = $('.selected');//抓取所有选中项
                   var len = $('.selected').length;//获取选中项的长度
                   var count = $('#count').text();//获取规格个数
                   var id = $('#id').text();
                   //将商品id放入隐藏标签
                   $('#goods_id').val(id);

                   if(len==count){      //如果所有选中项的长度=规格个数                     /

                       le.each(function(i,vbj){
                         //对抓取到的选中项each循环
                         spec_rule+=$(vbj).attr('attrid')+',';//拼接成选中的规格规则
                       });

                        spec_rule=spec_rule.slice(0,-1);//去掉最后的逗号

                        //将规格规则放入隐藏标签中
                        $('#spec_rule').val(spec_rule);

                       // 触发ajax对选中的规格为条件对规格价格表进行查询
                      $.ajax({
                          type:'post',
                          url:"{:U('home/ajax/total')}",
                          data:{
                                'spec_rule':spec_rule,
                                'goods_id':id,
                               },
                          success:function(i){
                            if(i){
                                var aa='';
                                aa+='<div class="mod_detailInfo_priceSales total" >';
                                aa+='<div class="Price clearfix">';
                                aa+='<label style="font-size:22px;width:80px;">总价：</label>';
                                aa+='<span>'+(parseFloat(i.spec_price)+parseFloat({$goods.sale_price}))+'元 &nbsp;&nbsp;<b>{$goods.goods_price}元</b></span>';
                                aa+='</div>';
                                aa+='</div>';
                                $('.select').css('display','none');
                                $('.total').remove();
                                $('.select').before(aa);
                                //将对应规格的单价放到隐藏标签
                                $('#spec_price').val(parseFloat(i.spec_price)+parseFloat({$goods.sale_price}));
                                //库存件数动态显示
                                 var kk ='剩余：'+i.num+'件';
                                 $('.P_Quantity').text(kk);



                            }

                          }
                      })
                      //设置数量为可用状态
                      $('#buy-num').attr('disabled',false);


                   }else{
                        $('.total').remove();
                        $('.select').css('display','block');
                        $('.P_Quantity').text(' ');
                        $('#buy-num').attr('disabled','disabled');
                   }


              })


              $('.wrap_btn2').click(function(){
              var len = $('.selected').length;//获取选中项的长度
              var count = $('#count').text();//获取规格个数
                  if(len<count){
                      $(this).attr('href','JavaScript:void(0)');
                      alert('请选择规格');
                  }else{
                      $('#is_pay').val(1);
                      $('#ECS_FORMBUY').submit();
                  }
              })

              $('.wrap_btn1').click(function(){
              var len = $('.selected').length;//获取选中项的长度
              var count = $('#count').text();//获取规格个数
                  if(len<count){
                     $(this).attr('href','JavaScript:void(0)');

                     alert('请选择规格');
                  }else{
                      $('#is_pay').val(0);
                      $('#ECS_FORMBUY').submit();
                  }
              })



        })
</script>
</block>